package sweet.helper.fm

import freemarker.template.{ Configuration, TemplateExceptionHandler, TemplateDateModel }
import freemarker.cache.{ WebappTemplateLoader }
import freemarker.ext.beans.{ BeansWrapper }

class ScalaFreemarkerConfiguration extends Configuration {

  //Default constructor initialzation
  this.setTagSyntax(Configuration.AUTO_DETECT_TAG_SYNTAX)
  this.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER)
  
  val wrapper = new ScalaBeansWrapper
  wrapper.setMethodsShadowItems(false) // do not lookup method first.
  wrapper.setDefaultDateType(TemplateDateModel.DATETIME) //this allow java.util.Date to work from model.
  wrapper.setUseCache(true) //do caching by default.
  wrapper.setExposureLevel(BeansWrapper.EXPOSE_PROPERTIES_ONLY); //don't expose method, but propties only

  this.setObjectWrapper(wrapper)  
}
